using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class COM_SERVICIOS_COM_ATRIBUTOS : PaginaBaseKCG     
{
    protected void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        cargarBotones();
        fvservicios_com_atributo.DataBound += new EventHandler(fvservicios_com_atributo_DataBound);
    }

    void fvservicios_com_atributo_DataBound(object sender, EventArgs e)
    {
        DeshabilitraBotonesEnInsert(); 
        if (fvservicios_com_atributo.CurrentMode == FormViewMode.Insert)
        {
            TextBox _valorTipo = (TextBox)Fv.FindControl("Tipo");
            _valorTipo.Text = "SER";
        }
    }
    private void cargarBotones()
    {
        BtnSugerencia.Text = GetLocalResourceObject("Btn_Servicios_Com_Atributo_SugerenciaRecursoKCG.Text").ToString();
        BtnSugerencia.ToolTip = GetLocalResourceObject("Btn_Servicios_Com_Atributo_SugerenciaRecursoKCG.ToolTip").ToString();
    }
    private void DeshabilitraBotonesEnInsert()
    {
        if (Fv.CurrentMode == FormViewMode.Insert)
        {
            BtnSugerencia.Enabled = false;
        }
        if (Fv.CurrentMode == FormViewMode.Edit || Fv.CurrentMode == FormViewMode.ReadOnly)
        {
            BtnSugerencia.Enabled = true;
        }
    }

    protected override CheckBox CbInsertarMemoria
    {
        get { return null; }
    }

    protected override Type TipoObjeto
    {
        get { return typeof(global::Com_Atributo); }
    }

    protected override GridView Gv
    {
        get { return gvservicios_com_atributo; }
    }

    protected override FormView Fv
    {
        get { return fvservicios_com_atributo; }
    }

    protected override ObjectDataSource OdsGv
    {
        get { return odsgvservicios_com_atributo; }
    }

    protected override ObjectDataSource OdsDv
    {
        get { return odsfvservicios_com_atributo; }
    }

    protected override Button BResponderZoom
    {
        get { return Seleccionar; }
    }

    protected override Button BRegreso
    {
        get { return Atras; }
    }

    protected override Koala.KoalaWebControls.KFiltro KftFiltro
    {
        get { return kftFiltro; }
    }
    protected override string Contenedor
    {
        get { return "SERVICIOS_COM_ATRIBUTO"; }
    }

    protected void nav_Siguiente(object sender, EventArgs e)
    {
        Gv_SelectedIndexChanged(sender, e);
    }
    protected void BtnSugerencia_Click(object sender, EventArgs e)
    {
        TextBox AtributoId = (TextBox)Fv.FindControl("Id");
        TextBox AtributoCodigo = (TextBox)Fv.FindControl("Codigo");
        TextBox AtributoNombre = (TextBox)Fv.FindControl("Nombre");
        Response.Redirect("~/COM/COM_ATRIBUTO_DET.aspx?Com_Atributo_Id=" + AtributoId.Text + "&Com_Atributo_codigo=" + AtributoCodigo.Text + "&Com_Atributo_Nombre=" + AtributoNombre.Text);
    }
}
